package ro.romanescu.loc4j;

import java.net.URL;

import ro.romanescu.loc4j.xliff.TransUnit;

/**
 * Basic dictionary data containing the localized data.
 */
public interface Dictionary {
  
  
  /**
   * Language ISO encoding. For example "ro_RO" or "en_US" etc.
   * @return language unique ISO code
   */
  String getLanguageISOCode();


  /**
   * Setter for property isoCode.
   * @param languageISOCode ISO code for the language within dictionary
   */
  void setLanguageISOCode( String languageISOCode );


  /**
   * Language name in english.
   * @return Language name written in english language
   */
  String getLanguageName();


  /**
   * Setter for language name.
   * @param languageName Language name in english language
   */
  public void setLanguageName( String languageName );


  /**
   * Language name in native language of the dictionary.
   * @return Language name written in native language
   */
  String getLanguageNameNative();


  /**
   * Setter for language name.
   * @param languageNameNative Language name in native language of the dictionary.
   */
  void setLanguageNameNative( String languageNameNative );


  /**
   * Retrieve one value from the dictionary.
   * @param key Key for the specified value
   * @return String correspondent of the specified key
   */
  String getString( String key );
  
  
  /**
   * Retrieve the translation unit associated with that key.
   * A translation unit keeps more than the value associated, according to
   * OASIS XLIFF specification.
   * @param key Key for the specified translation unit
   * @return Translation unit for that key or null if no associated value exists
   */
  TransUnit getTranslationUnit( String key );
  
  
  /**
   * Retrieve the path to the XLIFF file.
   * @return Path as URL
   */
  URL getXliff();
  
  
  /**
   * Set the path to the XLIFF file.
   * @param xliff URL path to the XLIFF file
   */
  void setXliff( URL xliff );
  
  
  /**
   * Dictionary is loaded.
   * @return true if dictionary has been loaded
   */
  boolean isLoaded();
  
  
  /**
   * Configure the dictionary to lazy load itself (true) or not (false).
   * @param lazyLoading Lazy initialization strategy
   * @throws LocalizationException If dictionary has already been loaded
   */
  void setLazyLoading( boolean lazyLoading ) throws LocalizationException;
  
  
  /**
   * Retrieve the lazy loading flag.
   * @return true if dictionary is lazy loading itself
   */
  boolean isLazyLoading();
}
